package com.qdxwx.manage.shiro.realm;

import org.apache.shiro.authc.AuthenticationToken;

/**
 * @author ZhiYong
 * @updateTime 2022/7/12 16:21
 * @description
 */
public class UserLoginToken implements AuthenticationToken {

    private static final long serialVersionUID = 2487567296188365847L;

    private String username;
    private String password;


    public UserLoginToken(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public Object getPrincipal() {
        return this.getUsername();
    }

    @Override
    public Object getCredentials() {
        return this.getPassword();
    }

    public void clear() {
        this.username = null;
        this.password = null;
    }

    public String toString() {
        return this.getClass().getName() +
                " - " +
                this.username;
    }
}